package cn.echogo.demo.widget;

import android.graphics.BitmapFactory;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Gallery;
import cn.echogo.framework.widget.imagezoom.ImageViewTouch;
import cn.echogo.framework.widget.imagezoom.PhotoPagerAdapter;
import cn.echogo.ipart.R;

public class ImageZoomTestActivity extends FragmentActivity implements OnClickListener {

	private static final String tag = ImageZoomTestActivity.class.getSimpleName();

	private Gallery gallery;
	private ImageViewTouch ivPhoto;
	private ViewPager viewPager;
	private PhotoPagerAdapter pageAdapter;

	int[] imgIds = { R.drawable.img01, R.drawable.img02, R.drawable.img03 };
	int index = 0;

	protected void onCreate(android.os.Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.demo_image_zoom);
		
		Button btn = (Button) findViewById(R.id.btn);
		btn.setOnClickListener(this);

		viewPager = (ViewPager) findViewById(R.id.viewPager);
		
		//
//		pageAdapter = new PhotoPagerAdapter(this, 3, R.drawable.icon_lady);
//		viewPager.setAdapter(pageAdapter);
		
//		viewPager.setOnPageChangeListener(this);


	}
	
	@Override
	public void onClick(View v) {
		int index = viewPager.getCurrentItem();
		pageAdapter.setPhotoBitmap(index, BitmapFactory.decodeResource(getResources(), imgIds[index]));
	}

}
